package demo.lifecycle;

import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

/**
 * Created with IntelliJ IDEA.
 * User: neerajY
 * Date: 8/22/13
 * Time: 4:00 AM
 * To change this template use File | Settings | File Templates.
 */
public class App {

    public static void main(String args[]) {

        Resource resource = new ClassPathResource("application-context.xml");
        XmlBeanFactory factory = new XmlBeanFactory(resource);

        //Get Bean
        AccountService accountService = (AccountService)factory.getBean("accountService");
        System.out.println("<<** Interest on balance :"+accountService.calculateInterest() +" ** >>") ;

        //Destroy
        factory.destroySingleton("accountService");

    }

}
